using System;
using System.IO;
using System.Text;

namespace iPhOwa.Exchange
{
	/// <summary>
	/// HACK: Have to extend string writer to change the encoding.
	/// </summary>
	internal class EncodingStringWriter : StringWriter
	{
		private readonly Encoding encoding;

		/// <summary>
		/// Constructor.
		/// </summary>
		public EncodingStringWriter(Encoding encoding, IFormatProvider formatProvider) : base(formatProvider)
		{
			this.encoding = encoding;
		}

		/// <summary>
		/// Gets the <see cref="T:System.Text.Encoding"></see> in which the output is written.
		/// </summary>
		/// <returns>
		/// The Encoding in which the output is written.
		/// </returns>
		/// <filterpriority>1</filterpriority>
		public override Encoding Encoding
		{
			get { return encoding; }
		}
	}
}